package com.jingzhi.huimiao.fragment;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jingzhi.huimiao.R;

/**
 * 发现界面
 * 
 * @author cxk
 * 
 */
public class FindFragment extends Fragment implements OnClickListener {

	private TextView title;
	private LinearLayout tv_title;// 小狸
	private ImageView xiaoli;// 小狸
	private ImageView laoheshang;// 老和尚
	private Intent intent;

	@Override
	public View onCreateView(LayoutInflater inflater,
			@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
		// TODO Auto-generated method stub

		View view = View.inflate(getActivity(), R.layout.fragment_tab3, null);
		title = (TextView) view.findViewById(R.id.tv_title);
		tv_title = (LinearLayout) view.findViewById(R.id.iv_back_tomain);
		tv_title.setVisibility(View.GONE);
		title.setText("发现");

		xiaoli = (ImageView) view.findViewById(R.id.find_li);
		laoheshang = (ImageView) view.findViewById(R.id.find_heshang);

		intent = new Intent();
		xiaoli.setOnClickListener(this);
		laoheshang.setOnClickListener(this);

		return view;
	}

	@Override
	public void onDestroyView() {
		// TODO Auto-generated method stub
		super.onDestroyView();
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.find_li:
			
			intent.setAction(Intent.ACTION_VIEW);
			intent.addCategory(Intent.CATEGORY_BROWSABLE);
			intent.setData(Uri.parse("https://www.baidu.com/"));
			startActivity(intent);
			break;
		case R.id.find_heshang:
			intent.setAction(Intent.ACTION_VIEW);
			intent.addCategory(Intent.CATEGORY_BROWSABLE);
			intent.setData(Uri.parse("http://www.sina.com.cn/"));
			startActivity(intent);
			break;

		default:
			break;
		}

	}
}
